/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.rh.game.impl;

import com.rh.game.Character;
import com.rh.game.GameCondition;

import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

/**
 *
 * @author Hayden
 */
public class ShowImage {
    public static final List<ShowImage> EMPTY_LIST = Collections.unmodifiableList(new ArrayList<ShowImage>());

    public ShowImage(Character pWhom, List<String> pTypeCodes, String pImage)  {
        me = pWhom;
        image = pImage;
        conditions = new ArrayList<GameCondition>();
        for (String type : pTypeCodes)  {
            conditions.add(new GameCondition1(GameCondition1.Type.valueOf(type), me));
        }
    }

    private List<GameCondition> conditions = GameCondition.EMPTY_LIST;
    private String image = "";
    private Character me = null;
    
    public boolean useImage()  {
        boolean use = true;
        for (GameCondition gc : conditions)  {
            boolean tf = gc.evaluate(me);
            use = (use) && (tf);
        }
        return use;
    }
    
    public String getImage()  {
        return image;
    }
}
